home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / MW 8 2003 CD1.iso / Inside Macworld / Product News / gimp-1.2.4.sit / gimp-1.2.4 / build / win32 / compile-resource < prev    next >
Encoding:
Text File  |  2002-09-19  |  1.6 KB  |  47 lines

  1. #!/bin/bash
  2.  
  3. # Script to compile a resource file for a DLL if there is a .rc file
  4. # for it. The resource source file is supposed to contain a version
  5. # info section, that uses the string BUILDNUMBER as the least
  6. # significant part of the version numbers. This script replaces that
  7. # string with a "build number" before compiling the binary resource
  8. # file. The build number is kept between builds in a "stamp" file, and
  9. # incremented each time. (If there is no stamp file, build number 0 is
  10. # used.) The intention is that only the "official" maintainer of a DLL
  11. # keeps such a stamp file, and thus the DLLs he releases have
  12. # increasing version number resources, which can be used by an
  13. # installer program to decide whether to replace an existing DLL with
  14. # the same name.
  15.  
  16. # This is just my (tml@iki.fi) idea, if somebody comes up with a
  17. # better way to generate version number resources, don't hesitate to
  18. # suggest.
  19.  
  20. # The command line arguments are:
  21. # $1: the name of the .rc file to check
  22. # $2: the name of the resource object file to produce, if the rc file exists
  23.  
  24. # Check if we have a resource file for this DLL.
  25. rcfile=$1
  26. resfile=$2
  27. if [ -f $rcfile ]; then
  28.     # Check if we have a build number stamp file.
  29.     basename=`basename $rcfile .rc`
  30.     if [ -f $basename-build.stamp ]; then
  31.     read number <$basename-build.stamp
  32.     buildnumber=$[number+1]
  33.     echo Build number $buildnumber
  34.     echo $buildnumber >$basename-build.stamp
  35.     else
  36.     echo Using zero as build number
  37.         buildnumber=0
  38.     fi
  39.  
  40.     m4 -DBUILDNUMBER=$buildnumber <$rcfile >$$.rc &&
  41.     windres $$.rc $resfile &&
  42.     rm $$.rc
  43. else
  44.     # Return failure
  45.     exit 1
  46. fi
  47.